package mBeanControl.interfacesImpl;

import javax.management.MBeanServerConnection;
import javax.management.ObjectName;

import mBeanControl.interfaces.IThreads;

public class ThreadsRuntime implements IThreads{
	
	private MBeanServerConnection connection;
	private ObjectName threadPoolRuntime;
	
	public ThreadsRuntime(MBeanServerConnection connection, ObjectName threadPoolRuntime) {
		this.connection = connection;
		this.threadPoolRuntime = threadPoolRuntime;
	}

	public Integer getExecuteThreadIdleCount() {
		try {
			return (Integer) connection.getAttribute(threadPoolRuntime, "ExecuteThreadIdleCount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public Integer getPendingUserRequestCount() {
		try {
			return (Integer) connection.getAttribute(threadPoolRuntime, "PendingUserRequestCount");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
